Extending Hindley-Milner Type Inference with Coercive Structural Subtyping
نویسندگان
چکیده
We investigate how to add coercive structural subtyping to a type system for simply-typed lambda calculus with Hindley-Milner polymorphism. Coercions allow to convert between different types, and their automatic insertion can greatly increase readability of terms. We present a type inference algorithm that, given a term without type information, computes a type assignment and determines at which positions in the term coercions have to be inserted to make it type-correct according to the standard Hindley-Milner system (without any subtypes). The algorithm is sound and, if the subtype relation on base types is a disjoint union of lattices, also complete. The algorithm has been implemented in the proof assistant Isabelle.
منابع مشابه
Extending Hindley-Milner Type Inference with Coercive Structural Subtyping (long version)
We investigate how to add coercive structural subtyping to a type system for simply-typed lambda calculus with Hindley-Milner polymorphism. Coercions allow to convert between different types, and their automatic insertion can greatly increase readability of terms. We present a type inference algorithm that, given a term without type information, computes a type assignment and determines at whic...
متن کاملExtending Hindley-Milner Type Inference with Coercive Subtyping (long version)
We investigate how to add coercive structural subtyping to a type system for simply-typed lambda calculus with Hindley-Milner polymorphism. Coercions allow to convert between different types, and their automatic insertion can greatly increase readability of terms. We present a type inference algorithm that, given a term without type information, computes a type assignment and determines at whic...
متن کاملCoercions in a polymorphic type system
The idea of coercive subtyping, a theory of abbreviation for dependent type theories, is incorporated into the polymorphic type system in functional programming languages. The traditional type system with let-polymorphism is extended with argument coercions and function coercions, and a corresponding type inference algorithm is presented and proved to be sound and complete.
متن کاملSimple Type Inference for Structural Polymorphism
We propose a new way to mix constrained types and type inference, where the interaction between the two is minimal. By using local constraints embedded in types, rather than the other way round, we obtain a system which keeps the usual structure of an Hindley-Milner type system. In practice, this means that it is easy to introduce local constraints in existing type inference algorithms. Eventho...
متن کاملType Inference with Constrained Types
In this paper we present a general framework HM(X) for Hindley/Milner style type systems with constraints. We give a generic type inference algorithm for HM(X). Under suucient conditions on X, type inference will always compute the principal type of a term. We give an extension of our HM(X) systems which deals with subtyping. In particular, the type inference algorithm for subtypes computes pri...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2011